package vng.wcc.sonph.LauncherGenerator;

public class TabFormatter {
	private static final double RATIO_TABSYMBOL_ICON =  0.3;

	private int tabHeight;
	private int tabCellWidth;
	private int tabMinPadding;
	private int tabImageSize;
	private int tabLeftPadding;
	private int tabRightPadding;
	private int tabTopPadding;
	private int tabBottomPadding;
	private int tabCellHeight;
	private int horiTabPadding;
	
	/**
	 * This class provides layout information for TabRowView and TabCellView
	 * @param formatter the general formatter for all views
	 * @param numPages number of pages to show
	 */
	public TabFormatter(Formatter formatter,int numPages) {
		
		this.tabCellHeight = (int) (formatter.getIconImageSize() * RATIO_TABSYMBOL_ICON);
		this.tabHeight = 2 * this.tabCellHeight;
//		this.tabHeight = 
//			formatter.getScreenHeight() -			
//			(Formatter.mapScreenWidth2SystemIconsTabHeight.get(formatter.getScreenWidth())) -
//			formatter.getTopTabHeight() -
//			formatter.getFlipperViewHeight();

//		this.tabCellWidth = (formatter.getScreenWidth() - 2*formatter.getPaddingAll())/numPages;
		this.tabMinPadding = 2;
		this.tabImageSize = tabCellHeight - 2 * tabMinPadding;
		this.tabCellWidth = tabCellHeight;
		
//		this.tabImageSize = Math.min(tabCellWidth - 2 * tabMinPadding, tabCellHeight - 2*tabMinPadding);
//		this.tabImageSize = (int) Math.min(tabCellWidth - 2 * tabMinPadding, formatter.getIconImageSize() * RATIO_TABSYMBOL_ICON - 2 * tabMinPadding);		
		this.tabLeftPadding = (tabCellWidth - tabImageSize) / 2;
		this.tabRightPadding = (tabCellWidth - tabImageSize) / 2;
//		this.tabBottomPadding = formatter.getPaddingAll();
		this.tabBottomPadding = (tabHeight - tabImageSize ) / 2;
		this.tabTopPadding = (tabHeight - tabImageSize - tabBottomPadding);
		
		this.horiTabPadding = (formatter.getScreenWidth() - numPages * tabCellWidth) / 2;
	}

	public int getTabWidth() {
		return tabCellWidth;
	}

	public void setTabWidth(int tabWidth) {
		this.tabCellWidth = tabWidth;
	}

	public int getTabMinPadding() {
		return tabMinPadding;
	}

	public void setTabMinPadding(int tabMinPadding) {
		this.tabMinPadding = tabMinPadding;
	}

	public int getTabImageSize() {
		return tabImageSize;
	}

	public void setTabImageSize(int tabImageSize) {
		this.tabImageSize = tabImageSize;
	}

	public int getTabLeftPadding() {
		return tabLeftPadding;
	}

	public void setTabLeftPadding(int tabLeftPadding) {
		this.tabLeftPadding = tabLeftPadding;
	}

	public int getTabRightPadding() {
		return tabRightPadding;
	}

	public void setTabRightPadding(int tabRightPadding) {
		this.tabRightPadding = tabRightPadding;
	}

	public int getTabTopPadding() {
		return tabTopPadding;
	}

	public void setTabTopPadding(int tabTopPadding) {
		this.tabTopPadding = tabTopPadding;
	}

	public int getTabBottomPadding() {
		return tabBottomPadding;
	}

	public void setTabBottomPadding(int tabBottomPadding) {
		this.tabBottomPadding = tabBottomPadding;
	}

	public void setTabHeight(int tabHeight) {
		this.tabHeight = tabHeight;
	}
	public int getTabHeight() {
		return tabHeight;
	}

	public int getHoriTabPadding() {
		return horiTabPadding;
	}


}
